
#include "files.h"

vector<string> getFilePathList(string dirPath) {
    struct dirent *ptr;
    DIR *dir;
    dir = opendir(dirPath.c_str());
    vector<string> imgPath;
//    cout << "文件列表: " << endl;
    while ((ptr = readdir(dir)) != nullptr) {
        //跳过'.'和'..'两个目录
        if (ptr->d_name[0] == '.')
            continue;
//        cout << ptr->d_name << endl;
        imgPath.emplace_back(ptr->d_name);
    }
    for (auto &i : imgPath) {
        i = dirPath + "/" + i;
    }
    return imgPath;
}
